using System;
using System.Collections;
namespace AppToolKit.Core.ObjectClone
{
	public class CloneVisit
	{
		private ArrayList visit_;
		public CloneVisit()
		{
			this.visit_ = new ArrayList();
			this.visit_.Add(new DeepCopyClone());
		}
		public void Register(IDeepCopy copy)
		{
			this.visit_.Add(copy);
		}
		public object Visit(object o)
		{
			object result = o;
			if (o != null)
			{
				Type type = o.GetType();
				foreach (IDeepCopyVisitor deepCopyVisitor in this.visit_)
				{
					if (deepCopyVisitor.IsSuppor(type))
					{
						result = deepCopyVisitor.DeepCopy(o);
						break;
					}
				}
			}
			return result;
		}
	}
}
